import { Tag,Button,Toast} from "antd-mobile";
import React, { Component } from 'react'
import styles from "./address.module.scss";
import { connect } from "react-redux";
import { withRouter } from "react-router-dom";
import axios from '../../utils/myaxios'
class updateAddress extends Component {
  state={
    code:200
  }
  successToast=()=> {
    axios.post('/user/modifyAddress',{addressID:123,addressModel:{}}).then(res=>{
      // console.log(res)
    })
    if(this.state.code===200){
      Toast.success('保存成功', 1);
    }
  }
    render() {
        return (
            <div>
             <div className={styles.addAddress}>
          <div className={styles.topNavLeft}>
            <svg
              className={styles.icon}
              aria-hidden="true"
              onClick={() => {
                this.props.history.push("/address");
              }}
            >
              <use href="#icon-zuojiantou"></use>
            </svg>
          </div>
          <div className={styles.topNavCenter}>编辑地址</div>
          <div className={styles.topNavRight}>
          <svg
              className={styles.icon}
              aria-hidden="true"
              onClick={() => {
                // this.props.history.push("/address");
              }}
            >
              <use href="#icon-shanchu"></use>
            </svg>
          </div>
        </div>

        <div className={styles.addressForm}>
            <p><label htmlFor="name">姓名</label><input type="text" id="name" placeholder="阿华" /></p>
            <p><label htmlFor="tel">电话</label><input type="text" id="tel" placeholder="15207072416" /></p>
            <p><label htmlFor="address">地址</label><input type="text" id="address" placeholder="深圳西部硅谷" /><em onClick={() => {
                this.props.history.push('/map')
            }
            }>{">"}</em></p>
            <p><label htmlFor="doorNum">门牌号</label><input type="text" id="doorNum" placeholder="2003" /></p>
            <div className={styles.p}><label>标签</label>
            <Tag>家</Tag>
            <Tag style={{margin:"0 10px"}}>公司</Tag>
            <Tag >学校</Tag>
            </div>
        </div>
        <div className={styles.save}>
        <Button onClick={this.successToast} style={{background:"#4DC060",color:"#fff"}}>保存</Button>
        </div>
      </div>
    );
  }
}
const mapStateToProps = (state) => {
  return {
    isLogin: state.userReducer.isLogin,
  };
};
export default withRouter(connect(mapStateToProps, null)(updateAddress));
